<template>
  <div>
    <div style="margin-bottom: 30px">
      <el-breadcrumb separator="/">
        <el-breadcrumb-item :to="{ path: '/home' }">首页</el-breadcrumb-item>
        <el-breadcrumb-item>车辆运营信息</el-breadcrumb-item>
      </el-breadcrumb>
    </div>
    <h2>车辆简讯 <i class="el-icon-truck"></i></h2><br/>
    <el-collapse v-model="activeName" accordion>
      <el-collapse-item v-for="vehicle in vehicles" @click.native="getTransbyid(vehicle.id)">
        <template slot="title">
          <h3 style="color:#909399"><i class="el-icon-truck"></i></h3>
          <el-divider direction="vertical"></el-divider>
          <h3 style="color:#409EFF">车牌号：{{ vehicle.vehicleId }}</h3>
          <el-divider direction="vertical"></el-divider>
          <h3 style="color:#409EFF">车型：{{ vehicle.vehicleStytle }}</h3>
          <el-divider direction="vertical"></el-divider>
          <h3 style="color:#409EFF">车别：{{ vehicle.vehicleModel }}</h3>
          <el-divider direction="vertical"></el-divider>
          <h5 style="color:#E6A23C">点击查看<i class="el-icon-view"></i></h5>
        </template>
        <el-descriptions class="margin-top" title="车辆运输记录" :column="3" size="medium" border v-for="tran in trans">
          <el-descriptions-item>
            <template slot="label">
              订单id<i class="el-icon-date"></i>
            </template>
            {{ tran.orderId }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-money"></i>
              订单金额
            </template>
            {{ tran.goodsOrder.money }}元
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-office-building"></i>
              收货公司
            </template>
            {{ tran.goodsOrder.receiveCompany.companyName }}元
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-location-information"></i>
              收货地址
            </template>
            {{ tran.goodsOrder.receiveCompany.companyAdress }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-position"></i>
              路线id
            </template>
            {{ tran.route }}
          </el-descriptions-item>
          <el-descriptions-item>
            <template slot="label">
              <i class="el-icon-message"></i>
              备注
            </template>
            {{ tran.remark }}
          </el-descriptions-item>
        </el-descriptions>
      </el-collapse-item>
    </el-collapse>

  </div>
</template>

<script>
import request from "@/utils/request";

export default {
  name: "Vehicleoperation",
  data() {
    return {
      activeName: '1',
      vehicles:[],
      areaCodes:[],
      trans:[],
      rules:{},
    };
  },
  created() {
    this.load()

  },
  methods: {
    load() {
      request.get("/vehicleInfo/get").then(res => {
        this.vehicles = res.data
      })
    },
    getTransbyid(id){
      request.get("/vehicleTransInfo/"+id).then(res => {
        this.trans = res.data
      })
    }
  }
}
</script>

<style scoped>

</style>